/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-09-07 19:53:25
 * @LastEditors  : 飞越疯人院 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\SecurityActivity.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, OpenTwoRouter, OrdinaryQRCodeButton } from '../Common/options'

export const SecurityActivity = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}OC`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        options: [<AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            { ...commonTableList.tableName, title: '主题' },

            {
                dataIndex: 'interval',
                title: '活动时长',
                valueType: 'input',
                ellipsis: true,
                width: 200,
                hideInAdded: true,
                hideInModify: true,
            },
            {
                dataIndex: 'startTime',
                title: '开始时间',
                valueType: 'Date',
                showTime: true,
                ellipsis: true,
                rules: true,
                width: 200,
            },
            {
                dataIndex: 'endTime',
                title: '结束时间',
                valueType: 'Date',
                showTime: true,
                ellipsis: true,
                rules: true,
                width: 200,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 320,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <OpenTwoRouter
                            key="A01"
                            title="活动附件"
                            twoTitle="安全活动附件管理"
                            modal="TableList"
                            OptionsEvent={OptionsEvent}
                            other={{
                                page: 'SecurityActivityAnnex',
                                Permission,
                                oneData: record,
                                header: data.columns,
                            }}
                        />,
                        <OpenTwoRouter
                            key="A02"
                            title="参与人员"
                            twoTitle="安全活动参与人员"
                            modal="TableList"
                            OptionsEvent={OptionsEvent}
                            other={{
                                page: 'SecurityActivityPerson',
                                Permission,
                                oneData: record,
                                header: data.columns,
                            }}
                        />,
                        <OrdinaryQRCodeButton
                            key="qrcode"
                            title="活动二维码"
                            OptionsEvent={OptionsEvent}
                            data={{ url: record.uuid }}
                        />,
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url={url}
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
